home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!wyse!mikew
- From: mikew@wyse.wyse.com (Mike Wexler)
- Newsgroups: comp.sources.x
- Subject: v00i005: Ardent Window Manager(X11), Part04/13
- Message-ID: <1628@wyse.wyse.com>
- Date: 9 Aug 88 17:18:02 GMT
- Sender: news@wyse.wyse.com
- Lines: 1794
- Approved: mikew@wyse.com
-
- Submitted-by: jkh@ardent (Jordan Hubbard)
- Posting-number: Volume 0, Issue 5
- Archive-name: awm/part04
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 4 (of 13)."
- # Contents: awm/FocusChng.c awm/Iconify.c awm/Makefile
- # awm/MoveOpaque.c awm/Push.c awm/menu_sup.c awm/menus/menu.def.h
- # awm/menus/menu.h
- # Wrapped by mikew@wyse on Mon Aug 8 12:01:43 1988
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f awm/FocusChng.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/FocusChng.c\"
- else
- echo shar: Extracting \"awm/FocusChng.c\" \(5979 characters\)
- sed "s/^X//" >awm/FocusChng.c <<'END_OF_awm/FocusChng.c'
- X#ident "%W% %G%"
- X
- X
- X
- X#ifndef lint
- Xstatic char *rcsid_FocusChng_c = "$Header: FocusChng.c,v 1.5 88/07/23 17:36:00 jkh Exp $";
- X#endif lint
- X
- X#include "X11/copyright.h"
- X/*
- X *
- X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
- X *
- X * Copyright 1987 by Jordan Hubbard.
- X *
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Ardent Computer
- X * Corporation or Jordan Hubbard not be used in advertising or publicity
- X * pertaining to distribution of the software without specific, written
- X * prior permission.
- X *
- X */
- X
- X/*
- X * MODIFICATION HISTORY
- X *
- X * 001 -- Jordan Hubbard, U.C. Berkeley.
- X * Hacks for autoraise and titles.
- X * 002 -- Jordan Hubbard, Ardent Computer
- X * Window pixmap changes on focus in/out.
- X * 1.4 -- Fixed Focus In/Out handling. Created LightsOn() and LightsOff()
- X * to break out the actual process of "highlighting".
- X * 1.5 -- Added dynamic installation of colormaps.
- X */
- X
- X
- X#include "awm.h"
- X
- X#if defined(sun) || defined(ibm032) || defined(titan) || defined(vax)
- X#include <sys/time.h>
- X#else
- X#include <time.h>
- X#endif
- X
- XWindow FocusWindow;
- X
- XHandleFocusIn(ev)
- XXEvent *ev;
- X{
- X XEnterWindowEvent *e = (XEnterWindowEvent *)ev;
- X Window w = e->window;
- X AwmInfoPtr awi;
- X XEvent event;
- X
- X Entry("HandleFocusIn")
- X
- X if (!(Hilite || Autoraise || InstallColormap) || Snatched)
- X Leave(FALSE)
- X
- X awi = GetAwmInfo(w);
- X if (!awi) /* probably a menu or something */
- X Leave(FALSE)
- X w = (FrameFocus && awi->frame) ? awi->frame : awi->client;
- X
- X if (e->detail != NotifyInferior && (e->focus || FrameFocus)) {
- X struct timeval foo;
- X
- X if (e->type != FocusIn) {
- X foo.tv_sec = 0;
- X foo.tv_usec = RaiseDelay * 1000;
- X /*
- X * Sleep for awhile to avoid race conditions and give any
- X * potential leave events a chance to get here..
- X */
- X select(0, 0, 0, 0, &foo);
- X /* Did we leave this window already? */
- X if (XCheckTypedWindowEvent(dpy, w, LeaveNotify, &event))
- X if (event.xcrossing.detail != NotifyInferior)
- X Leave(FALSE)
- X if (InstallColormap) {
- X XWindowAttributes xwa;
- X
- X XGetWindowAttributes(dpy, w, &xwa);
- X XInstallColormap(dpy, xwa.colormap);
- X }
- X if (!FocusSetByUser && FocusWindow != awi->client &&
- X (awi->attrs & AT_INPUT)) {
- X if (FrameFocus) {
- X XSetInputFocus(dpy, awi->client, RevertToPointerRoot,
- X CurrentTime);
- X FocusSetByWM = TRUE;
- X }
- X FocusWindow = awi->client;
- X }
- X else
- X Leave(FALSE)
- X }
- X else {
- X FocusWindow = awi->client;
- X FocusSetByWM = FALSE;
- X }
- X
- X /*
- X * If Autoraise is set, raise that puppy..
- X */
- X if (Autoraise && (awi->attrs & AT_RAISE))
- X XRaiseWindow(dpy, (awi->frame) ? awi->frame : awi->client);
- X LightsOn(awi);
- X }
- X Leave(FALSE)
- X}
- X
- XHandleFocusOut(ev)
- XXEvent *ev;
- X{
- X XLeaveWindowEvent *e = (XEnterWindowEvent *)ev;
- X Window w = e->window;
- X AwmInfoPtr awi;
- X XEvent event;
- X
- X Entry("HandleFocusOut")
- X
- X awi = GetAwmInfo(w);
- X if (!awi) /* probably a menu or something */
- X Leave(FALSE)
- X
- X if (!(Hilite || Autoraise || InstallColormap) || Snatched)
- X Leave(FALSE)
- X
- X w = (FrameFocus && awi->frame) ? awi->frame : awi->client;
- X
- X if (e->detail != NotifyInferior && (e->focus || FrameFocus)) {
- X if (e->type != FocusOut) {
- X /* Did we come back into this window? */
- X if (XCheckTypedWindowEvent(dpy, w, EnterNotify, &event)) {
- X if (event.xcrossing.detail != NotifyInferior)
- X Leave(FALSE)
- X }
- X if (!FocusSetByUser) {
- X if (FrameFocus) {
- X XSetInputFocus(dpy, PointerRoot, None, CurrentTime);
- X FocusSetByWM = TRUE;
- X }
- X FocusWindow = RootWindow(dpy, scr);
- X }
- X else
- X Leave(FALSE)
- X }
- X else {
- X FocusWindow = RootWindow(dpy, scr);
- X FocusSetByWM = FALSE;
- X }
- X if (InstallColormap)
- X XInstallColormap(dpy, DefaultColormap(dpy, scr));
- X LightsOff(awi);
- X }
- X Leave(FALSE)
- X}
- X
- X/*
- X * Turns higlighting off for a window. Counterpart to LightsOn
- X */
- XLightsOff(awi)
- XAwmInfoPtr awi;
- X{
- X Entry("LightsOff")
- X
- X /* set the window border to "gray" stipple */
- X if (awi->attrs & AT_INPUT) {
- X if (BorderHilite)
- X SetBorderPixmaps(awi, GrayPixmap);
- X if (awi->frame) {
- X if (awi->back && awi->title)
- X XSetWindowBackgroundPixmap(dpy, awi->title,
- X awi->back);
- X if (awi->BC_back && (awi->attrs & AT_BORDER)) {
- X XSetWindowBackgroundPixmap(dpy, awi->frame,
- X awi->BC_back);
- X XClearWindow(dpy, awi->frame);
- X }
- X PaintTitle(awi->title, FALSE);
- X }
- X XSync(dpy, 0);
- X }
- X Leave(FALSE)
- X}
- X
- X
- X/*
- X * Highlight a window. This may involve shuffling pixmaps around
- X * and affecting more than just the client window.
- X */
- XLightsOn(awi)
- XAwmInfoPtr awi;
- X{
- X Entry("LightsOn")
- X
- X if (awi->attrs & AT_INPUT) {
- X if (BorderHilite)
- X SetBorderPixmaps(awi, SolidPixmap);
- X if (awi->frame) {
- X if (awi->bold && awi->title) {
- X XSetWindowBackgroundPixmap(dpy, awi->title,
- X awi->bold);
- X PaintTitle(awi->title, TRUE);
- X }
- X if (awi->BC_bold && (awi->attrs & AT_BORDER)) {
- X XSetWindowBackgroundPixmap(dpy, awi->frame,
- X awi->BC_bold);
- X XClearWindow(dpy, awi->frame);
- X }
- X XSync(dpy, 0);
- X }
- X }
- X Leave(FALSE)
- X}
- X
- Xvoid SetBorderPixmaps(awi, pix)
- XAwmInfoPtr awi;
- XPixmap pix;
- X{
- X Entry("SetBorderPixmaps")
- X
- X XSetWindowBorderPixmap(dpy, awi->client, pix);
- X if (awi->frame) {
- X if (awi->title)
- X XSetWindowBorderPixmap(dpy, awi->title, pix);
- X XSetWindowBorderPixmap(dpy, awi->frame, pix);
- X }
- X Leave_void
- X}
- END_OF_awm/FocusChng.c
- if test 5979 -ne `wc -c <awm/FocusChng.c`; then
- echo shar: \"awm/FocusChng.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f awm/Iconify.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/Iconify.c\"
- else
- echo shar: Extracting \"awm/Iconify.c\" \(6980 characters\)
- sed "s/^X//" >awm/Iconify.c <<'END_OF_awm/Iconify.c'
- X#ident "%W% %G%"
- X
- X
- X
- X#ifndef lint
- Xstatic char *rcsid_Iconify_c = "$Header: Iconify.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
- X#endif lint
- X
- X#include "X11/copyright.h"
- X/*
- X *
- X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
- X *
- X * Copyright 1987 by Jordan Hubbard.
- X *
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Ardent Computer
- X * Corporation or Jordan Hubbard not be used in advertising or publicity
- X * pertaining to distribution of the software without specific, written
- X * prior permission.
- X *
- X */
- X
- X/*
- X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Digital Equipment
- X * Corporation not be used in advertising or publicity pertaining to
- X * distribution of the software without specific, written prior permission.
- X *
- X *
- X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X * SOFTWARE.
- X */
- X
- X
- X
- X/*
- X * MODIFICATION HISTORY
- X *
- X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
- X * 001 -- R. Kittell, DEC Storage A/D May 20, 1986
- X * Add optional warp of mouse to the upper right corner on de-iconify,
- X * and to the icon center on iconify.
- X * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
- X * Western Software Lab. Port to X11.
- X * 003 -- Jordan Hubbard, Ardent Computer.
- X * Many mods to cope with context manager, titled windows. Almost a total
- X * rewrite.
- X */
- X
- X#include "awm.h"
- X
- XBoolean Iconify(window, mask, button, x, y)
- XWindow window; /* Event window. */
- Xint mask; /* Button/key mask. */
- Xint button; /* Button event detail. */
- Xint x, y; /* Event mouse position. */
- X{
- X XWindowAttributes fromInfo; /* info on "from" window */
- X XWindowAttributes toInfo; /* info on "to" window */
- X int mse_x, mse_y; /* Mouse X and Y coordinates. */
- X int sub_win_x, sub_win_y; /* relative Mouse coordinates. */
- X int num_vectors; /* Number of vectors in zap buffer. */
- X int mmask; /* Mouse state */
- X Window root; /* Mouse root window. */
- X Window from, to; /* from -> to windows */
- X Window sub_win; /* Mouse position sub-window. */
- X XSegment zap[MAX_ZAP_VECTORS]; /* Zap effect vertex buffer. */
- X Boolean dozap; /* local Zap */
- X AwmInfoPtr awi;
- X
- X Entry("Iconify")
- X
- X /*
- X * Do not try to iconify the root window.
- X */
- X if (window == RootWindow(dpy, scr))
- X Leave(FALSE)
- X /*
- X * The original idea of zap lines has one flaw. If a window wants
- X * to be created iconic, it should just appear that way without any
- X * fuss. CheckMap() calls us with (win, 0, 0, 0, 0) when this is the
- X * case, so we can special case this to turn off Zap temporarily.
- X * Since we don't want to mess with the global "Zap", we use
- X * "dozap" instead.
- X */
- X dozap = (mask || button || x || y) ? Zap : FALSE;
- X /*
- X * Clear the vector buffer.
- X */
- X if (dozap)
- X bzero(zap, sizeof(zap));
- X
- X /*
- X * Get the mouse cursor position in case we must put a new
- X * icon there.
- X */
- X XQueryPointer(dpy, RootWindow(dpy, scr), &root, &sub_win,
- X &mse_x, &mse_y, &sub_win_x, &sub_win_y, &mmask);
- X
- X
- X /*
- X * Figure out which direction we're going in (icon->window or vica-versa)
- X */
- X awi = GetAwmInfo(window);
- X if (!awi)
- X Leave(FALSE)
- X if (awi->state & ST_ICON) {
- X from = awi->icon;
- X to = (awi->frame) ? awi->frame : awi->client;
- X if (!(awi->state & ST_PLACED))
- X PlaceWindow(to);
- X }
- X else if (awi->state & ST_WINDOW) {
- X from = (awi->frame) ? awi->frame : awi->client;
- X to = (awi->icon) ? awi->icon : MakeIcon(window, mse_x, mse_y, TRUE);
- X }
- X else {
- X printf("Iconify: Window %x has unknown state '%x'\n",
- X awi->client, awi->state);
- X Leave(FALSE)
- X }
- X status = XGetWindowAttributes(dpy, from, &fromInfo);
- X if (status == FAILURE)
- X Leave(FALSE)
- X status = XGetWindowAttributes(dpy, to, &toInfo);
- X if (status == FAILURE)
- X Leave(FALSE)
- X
- X /*
- X * Store the zap vector buffer.
- X */
- X if (dozap) {
- X num_vectors =
- X StoreZap(zap,
- X fromInfo.x - 1,
- X fromInfo.y - 1,
- X fromInfo.x + fromInfo.width +
- X (fromInfo.border_width << 1),
- X fromInfo.y + fromInfo.height +
- X (fromInfo.border_width << 1),
- X toInfo.x - 1,
- X toInfo.y - 1,
- X toInfo.x + toInfo.width +
- X (toInfo.border_width << 1),
- X toInfo.y + toInfo.height +
- X (toInfo.border_width << 1));
- X }
- X if (awi->state & ST_ICON) {
- X if (!awi->frame)
- X XRemoveFromSaveSet(dpy, awi->client);
- X awi->state ^= ST_ICON;
- X awi->state |= ST_WINDOW;
- X }
- X else if (awi->state & ST_WINDOW) {
- X XAddToSaveSet(dpy, awi->client);
- X awi->state ^= ST_WINDOW;
- X awi->state |= ST_ICON;
- X }
- X else
- X fprintf(stderr, "Window state for window %x got munged!\n",
- X awi->client);
- X /*
- X * Map the target.
- X */
- X XMapRaised(dpy, to);
- X if (dozap) {
- X /*
- X * Draw the zap lines.
- X */
- X DrawZap();
- X }
- X /*
- X * Unmap the "from" window.
- X */
- X XUnmapWindow(dpy, from);
- X XFlush(dpy);
- X /*
- X * Optionally warp the mouse to the upper right corner of the
- X * window.
- X */
- X if (WarpOnDeIconify && awi->state & ST_WINDOW) {
- X int y;
- X
- X y = (toInfo.height >= 10) ? 10 : toInfo.height / 2;
- X if (awi->frame) { /* compensate for title */
- X XWindowAttributes xwa;
- X XGetWindowAttributes(dpy, awi->title, &xwa);
- X y += xwa.height + 2;
- X }
- X status = XWarpPointer (dpy, None, to,
- X 0, 0, 0, 0,
- X toInfo.width >= 7 ?
- X toInfo.width - 7 : toInfo.width / 2,
- X y);
- X }
- X
- X if (WarpOnIconify && awi->state & ST_ICON)
- X status = XWarpPointer (dpy, None, to,
- X 0, 0, 0, 0,
- X toInfo.width / 2, toInfo.height / 2);
- X Leave(FALSE)
- X}
- END_OF_awm/Iconify.c
- if test 6980 -ne `wc -c <awm/Iconify.c`; then
- echo shar: \"awm/Iconify.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f awm/Makefile -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/Makefile\"
- else
- echo shar: Extracting \"awm/Makefile\" \(6591 characters\)
- sed "s/^X//" >awm/Makefile <<'END_OF_awm/Makefile'
- X#
- X# Warning: the cpp used on this machine replaces
- X# all newlines and multiple tabs/spaces in a macro
- X# expansion with a single space. Imake tries to
- X# compensate for this, but is not always
- X# successful.
- X#
- X
- X#
- X# This makefile is automatically generated by imake... do not modify
- X# or you may lose your changes when imake generates makefiles again.
- X# Ignore this message if you are not using imake.
- X#
- X
- X TOP = /usr/new/src/x/x11.2
- X AS = as
- X CC = cc
- X CPP = /lib/cpp
- X LD = ld
- X LINT = lint
- X INSTALL = install
- X TAGS = ctags
- X RM = rm -f
- X MV = mv
- X LN = ln -s
- X RANLIB = ranlib
- X AR = ar clq
- X LS = ls
- X LINTOPTS = -axz
- X LINTLIBFLAG = -C
- X MAKE = make
- X STD_DEFINES =
- X CDEBUGFLAGS = -O4
- X DESTDIR = /usr/new
- X
- X PATHSEP = /
- X DEPEND = $(DEPENDSRC)/makedepend
- X IMAKE = $(IMAKESRC)/imake
- X RGB = $(RGBSRC)/rgb
- X CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
- X LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
- X LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
- X INSTUIDFLAGS = -m 4755
- X INSTLIBFLAGS = -m 0664
- X INSTINCFLAGS = -m 0444
- X INSTMANFLAGS = -m 0444
- X INSTAPPFLAGS = -m 0444
- X
- X USRLIBDIR = $(DESTDIR)/usr/lib
- X BINDIR = $(DESTDIR)/usr/bin/X11
- X LIBDIR = $(USRLIBDIR)/X11
- X LINTLIBDIR = $(USRLIBDIR)/lint
- X INCDIR = $(DESTDIR)/usr/include/X11
- X FONTDIR = $(LIBDIR)/fonts
- X UWMDIR = $(LIBDIR)/uwm
- X AWMDIR = $(LIBDIR)/awm
- X MANDIR = $(DESTDIR)/usr/man/mann
- X XAPPLOADDIR = $(LIBDIR)/app-defaults
- X ADMDIR = $(DESTDIR)/usr/adm
- X
- X CLIENTSRC = $(TOP)/clients
- X DEMOSRC = $(TOP)/demos
- X LIBSRC = $(TOP)/lib
- X FONTSRC = $(TOP)/fonts
- X INCLUDESRC = $(TOP)/X11
- X SERVERSRC = $(TOP)/server
- X UTILSRC = $(TOP)/util
- X EXAMPLESRC = $(TOP)/examples
- X CONTRIBSRC = $(TOP)/contrib
- X DOCSRC = $(TOP)/doc
- X DEPENDSRC = $(UTILSRC)/makedepend
- X IMAKESRC = $(UTILSRC)/imake
- X IRULESRC = $(UTILSRC)/imake.includes
- X RGBSRC = $(UTILSRC)/rgb
- X XLIBSRC = $(LIBSRC)/X
- X TOOLKITSRC = $(LIBSRC)/Xt
- X AWIDGETSRC = $(LIBSRC)/Xaw
- X OLDXLIBSRC = $(LIBSRC)/oldX
- X EXTENSIONSRC = $(TOP)/extensions
- X XMANSRC = $(DOCSRC)/Xlib/Xman
- X EXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a
- X XLIB = $(USRLIBDIR)/libX11.a
- X OLDXLIB = $(OLDXLIBSRC)/liboldX.a
- X XTOOLLIB = $(TOOLKITSRC)/libXt.a
- X XAWLIB = $(AWIDGETSRC)/libXaw.a
- X LINTXLIB = $(XLIBSRC)/llib-lX11.ln
- X LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
- X LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
- X INCLUDES = -I$(TOP)
- X MACROFILE = Sun.macros
- X IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl \
- X -I$(NEWTOP)$(IRULESRC) \
- X -s Makefile
- X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
- X tags TAGS make.log
- X
- X MENU_LIB = menus
- X MENU_ARCH = $(MENU_LIB)/rtlmenu.a
- X NEATEN_LIB = /grgr/neaten
- X NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
- X SYS_LIBRARIES = -ll
- X OTHERSRCS = gram.y lex.l
- X YFLAGS = -d
- X HFILES = awm.h neaten.def.h neaten.ext.h support.h
- X
- X# Add the line -DCONSOLE to the appropriate DEFINES macro (see below) if
- X# you want output (stderr and stdout) to go to the system console.
- X#
- X
- X# Use these macros if you want the RTL Neaten package.
- X# Also make sure that NEATEN_LIB points to the right place. See the README
- X# file for instructions (though you can just define this and give it a shot).
- X# DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\" -DNEATEN
- X# LOCAL_LIBRARIES = $(NEATEN_ARCH) $(MENU_ARCH) $(XLIB)
- X
- X# Use these macros if you don't want the RTL Neaten package.
- X DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\"
- X LOCAL_LIBRARIES = $(MENU_ARCH) $(XLIB)
- X
- X# Define this if you're compiling XReadBitmapFileData with awm, rather
- X# than with Xlib. No guarantees that this will work with all source trees.
- X# To be totally sure, compile it with Xlib.
- X#XRDOBJ=XRdBitFD.o
- X
- X# Below is just for "make noident", remove it if you've moved XRdBitFD.c
- X# someplace else.
- XXRDSRC=XRdBitFD.c
- X
- XSRCS= globals.c Beep.c Bindings.c CircleDown.c CircleUp.c\
- X Cursors.c Focus.c GetButton.c GridBox.c Iconify.c Icons.c Lower.c\
- X Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
- X Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
- X StoreZap.c XError.c awm.c FocusChng.c Titlebar.c errHndlr.c \
- X Grab.c menu_sup.c Gadget.c support.c exp_path.c Neaten.c
- X
- XOBJS= gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
- X Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
- X Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
- X Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
- X StoreZap.o XError.o awm.o FocusChng.o Titlebar.o errHndlr.o \
- X Grab.o menu_sup.o Gadget.o support.o exp_path.o Neaten.o $(XRDOBJ)
- X
- X PROGRAM = awm
- X
- Xall:: awm
- X
- Xawm: $(OBJS) $(LOCAL_LIBRARIES)
- X $(RM) $@
- X $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS)
- X
- Xrelink::
- X $(RM) $(PROGRAM)
- X $(MAKE) $(MFLAGS) $(PROGRAM)
- X
- Xinstall:: awm
- X $(INSTALL) -c $(INSTALLFLAGS) awm $(BINDIR)
- X
- Xdepend:: $(DEPEND)
- X
- Xdepend::
- X $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
- X
- X$(DEPEND):
- X @echo "making $(DEPENDSRC)"; \
- X cd $(DEPENDSRC); $(MAKE)
- X
- Xclean::
- X $(RM) $(PROGRAM)
- X
- Xinstall:: system.awmrc
- X $(INSTALL) -c $(INSTALLFLAGS) system.awmrc $(AWMDIR)
- X
- X$(MENU_ARCH)::
- X @echo Making menu package...
- X @(cd $(MENU_LIB); make CC=$(CC) CFLAGS="$(CFLAGS)")
- X @echo done.
- X
- X$(NEATEN_ARCH)::
- X cp Makefile.rtl $(NEATEN_LIB)/Makefile
- X @echo Making Neaten package
- X @(cd $(NEATEN_LIB); make -f Makefile)
- X @echo done.
- X
- Xclean::
- X @echo Cleaning menus...
- X @(cd $(MENU_LIB); make clean)
- X @echo done.
- X rm -f y.tab.h
- X
- Xnoident::
- X @echo Removing ident lines from awm...
- X @for i in $(SRCS) $(OTHERSRCS) $(HFILES) $(XRDSRC); do \
- X sed -e '/#ident/D' < $$i > /tmp/x.$$i && \
- X mv /tmp/x.$$i $$i ; \
- X done
- X @(cd $(MENU_LIB); make noident)
- X @echo done.
- X
- XXRdBitFD.o:
- X $(CC) -c -I$(XLIBSRC) -I$(TOP) -I$(INCLUDESRC) XRdBitFD.c
- X
- Xclean::
- X $(RM_CMD) \#*
- X
- XMakefile:: $(IMAKE)
- X
- XMakefile:: Imakefile \
- X $(IRULESRC)/Imake.tmpl \
- X $(IRULESRC)/Imake.rules \
- X $(IRULESRC)/$(MACROFILE)
- X -$(RM) Makefile.bak; $(MV) Makefile Makefile.bak
- X $(IMAKE_CMD) -DTOPDIR=$(TOP)
- X
- X$(IMAKE):
- X @echo "making $(IMAKESRC)"; \
- X cd $(IMAKESRC); $(MAKE)
- X
- Xtags::
- X $(TAGS) -w *.[ch]
- X $(TAGS) -xw *.[ch] > TAGS
- X
- Xinstall::
- X @echo "install done"
- X
- XMakefiles::
- X
- END_OF_awm/Makefile
- if test 6591 -ne `wc -c <awm/Makefile`; then
- echo shar: \"awm/Makefile\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f awm/MoveOpaque.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/MoveOpaque.c\"
- else
- echo shar: Extracting \"awm/MoveOpaque.c\" \(5297 characters\)
- sed "s/^X//" >awm/MoveOpaque.c <<'END_OF_awm/MoveOpaque.c'
- X#ident "%W% %G%"
- X
- X
- X
- X#ifndef lint
- Xstatic char *rcsid_MoveOpaque_c = "$Header: MoveOpaque.c,v 1.1 88/06/15 15:26:34 jkh Exp $";
- X#endif lint
- X
- X#include "X11/copyright.h"
- X/*
- X *
- X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
- X *
- X * Copyright 1987 by Jordan Hubbard.
- X *
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Ardent Computer
- X * Corporation or Jordan Hubbard not be used in advertising or publicity
- X * pertaining to distribution of the software without specific, written
- X * prior permission.
- X *
- X */
- X
- X/*
- X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Digital Equipment
- X * Corporation not be used in advertising or publicity pertaining to
- X * distribution of the software without specific, written prior permission.
- X *
- X *
- X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X * SOFTWARE.
- X */
- X
- X
- X
- X/*
- X * MODIFICATION HISTORY
- X *
- X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
- X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
- X * Western Software Lab. Convert to X11.
- X * 002 -- Jordan Hubbard, Ardent Computer
- X * Changed to work with awm.
- X */
- X
- X#include "awm.h"
- X
- XBoolean MoveOpaque(window, mask, button, x, y)
- XWindow window; /* Event window. */
- Xint mask; /* Button/key mask. */
- Xint button; /* Button event detail. */
- Xint x, y; /* Event mouse position. */
- X{
- X int prev_x, prev_y; /* Previous mouse location. */
- X int rbound, dbound; /* potential right/down boundries */
- X int cur_x, cur_y; /* Current mouse location. */
- X int win_x, win_y; /* Current window location. */
- X int root_x; /* Root window X location. */
- X int root_y; /* Root window Y location. */
- X int ptrmask; /* state of ptr when queried */
- X XWindowAttributes window_info; /* Event window information. */
- X Window sub_window; /* Query mouse event sub-window. */
- X Window root; /* Query mouse event root. */
- X XEvent button_event; /* Button event packet. */
- X
- X Entry("MoveOpaque")
- X
- X /*
- X * Do not try to move the root window.
- X */
- X if (window == RootWindow(dpy, scr))
- X Leave(FALSE)
- X
- X /*
- X * Change the cursor.
- X */
- X grab_pointer();
- X
- X /*
- X * Gather info on the event window.
- X */
- X status = XGetWindowAttributes(dpy, window, &window_info);
- X if (status == FAILURE)
- X Leave(FALSE)
- X
- X /*
- X * Initialize movement variables.
- X */
- X prev_x = cur_x = x;
- X prev_y = cur_y = y;
- X win_x = window_info.x;
- X win_y = window_info.y;
- X rbound = ScreenWidth - (window_info.width + window_info.border_width);
- X dbound = ScreenHeight - (window_info.height + window_info.border_width);
- X
- X /*
- X * Main loop.
- X */
- X while (TRUE) {
- X
- X /*
- X * Check to see if we have a change in mouse button status.
- X * This is how we get out of this "while" loop.
- X */
- X if (XCheckMaskEvent(dpy,
- X ButtonPressMask | ButtonReleaseMask,
- X &button_event)) {
- X
- X /*
- X * If the button event was something other than the
- X * release of the original button pressed, then move the
- X * window back to where it was originally.
- X */
- X if ((button_event.type != ButtonRelease) ||
- X (((XButtonReleasedEvent *)&button_event)->button
- X != button)) {
- X ResetCursor(button);
- X XMoveWindow(dpy, window, window_info.x, window_info.y);
- X }
- X ungrab_pointer();
- X Leave(TRUE);
- X }
- X
- X /*
- X * Take care of all the little things that have changed;
- X * i.e., move the window, if necessary.
- X */
- X XQueryPointer(dpy, RootWindow(dpy, scr),
- X &root, &sub_window, &root_x, &root_y, &cur_x, &cur_y,
- X &ptrmask);
- X if ((cur_x != prev_x) || (cur_y != prev_y)) {
- X win_x += (cur_x - prev_x);
- X win_y += (cur_y - prev_y);
- X#ifdef titan /* align to 5x4 */
- X win_x += (win_x % 5);
- X win_y += (win_y % 4);
- X#endif /* titan */
- X if (Wall) {
- X if (win_x < 0)
- X win_x = 0;
- X else if (win_x > rbound)
- X win_x = rbound;
- X if (win_y < 0)
- X win_y = 0;
- X else if (win_y > dbound)
- X win_y = dbound;
- X }
- X XMoveWindow(dpy, window, win_x, win_y);
- X prev_x = cur_x;
- X prev_y = cur_y;
- X }
- X }
- X}
- END_OF_awm/MoveOpaque.c
- if test 5297 -ne `wc -c <awm/MoveOpaque.c`; then
- echo shar: \"awm/MoveOpaque.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f awm/Push.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/Push.c\"
- else
- echo shar: Extracting \"awm/Push.c\" \(5297 characters\)
- sed "s/^X//" >awm/Push.c <<'END_OF_awm/Push.c'
- X#ident "%W% %G%"
- X
- X
- X
- X#ifndef lint
- Xstatic char *rcsid_Push_c = "$Header: Push.c,v 1.1 88/06/15 15:21:37 jkh Exp $";
- X#endif lint
- X
- X#include "X11/copyright.h"
- X/*
- X *
- X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
- X *
- X * Copyright 1987 by Jordan Hubbard.
- X *
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Ardent Computer
- X * Corporation or Jordan Hubbard not be used in advertising or publicity
- X * pertaining to distribution of the software without specific, written
- X * prior permission.
- X *
- X */
- X
- X/*
- X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Digital Equipment
- X * Corporation not be used in advertising or publicity pertaining to
- X * distribution of the software without specific, written prior permission.
- X *
- X *
- X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X * SOFTWARE.
- X */
- X
- X
- X
- X/*
- X * MODIFICATION HISTORY
- X *
- X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
- X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
- X Western Software Lab. Convert to X11.
- X */
- X
- X#include "awm.h"
- X
- X#define SHOVE_DOWN 1
- X#define SHOVE_UP 2
- X#define SHOVE_LEFT 3
- X#define SHOVE_RIGHT 4
- X
- Xextern Boolean ShoveAll();
- X
- XBoolean ShoveDown(window, mask, button, x, y)
- XWindow window; /* Event window. */
- Xint mask; /* Button/key mask. */
- Xint button; /* Button event detail. */
- Xint x, y; /* Event mouse position. */
- X{
- X Entry("ShoveDown")
- X
- X Leave(ShoveAll(window, SHOVE_DOWN))
- X}
- X
- XBoolean ShoveUp(window, mask, button, x, y)
- XWindow window; /* Event window. */
- Xint mask; /* Button/key mask. */
- Xint button; /* Button event detail. */
- Xint x, y; /* Event mouse position. */
- X{
- X Entry("ShoveUp")
- X
- X Leave(ShoveAll(window, SHOVE_UP))
- X}
- X
- XBoolean ShoveLeft(window, mask, button, x, y)
- XWindow window; /* Event window. */
- Xint mask; /* Button/key mask. */
- Xint button; /* Button event detail. */
- Xint x, y; /* Event mouse position. */
- X{
- X Entry("ShoveLeft")
- X
- X Leave(ShoveAll(window, SHOVE_LEFT))
- X}
- X
- XBoolean ShoveRight(window, mask, button, x, y)
- XWindow window; /* Event window. */
- Xint mask; /* Button/key mask. */
- Xint button; /* Button event detail. */
- Xint x, y; /* Event mouse position. */
- X{
- X Entry("ShoveRight")
- X
- X Leave(ShoveAll(window, SHOVE_RIGHT))
- X}
- X
- XBoolean ShoveAll(w, direction)
- XWindow w;
- Xint direction;
- X{
- X XWindowAttributes winfo; /* Event window information. */
- X XWindowAttributes rinfo; /* Root window information. */
- X int xofs, yofs; /* Movement offsets. */
- X int x, y; /* New window position. */
- X
- X Entry("ShoveAll")
- X
- X /*
- X * Do not try to move the root window.
- X */
- X if (w == RootWindow(dpy, scr))
- X Leave(FALSE)
- X
- X /*
- X * Gather info on the event window.
- X */
- X status = XGetWindowAttributes(dpy, w, &winfo);
- X if (status == FAILURE) Leave(FALSE)
- X if (!Pushval && Push)
- X Pushval = DEF_PUSH;
- X
- X /*
- X * Calculate the movement offsets.
- X */
- X switch(direction) {
- X case SHOVE_DOWN:
- X xofs = 0;
- X yofs = Push ? (winfo.height / Pushval) : Pushval;
- X break;
- X case SHOVE_UP:
- X xofs = 0;
- X yofs = 0 - (Push ? (winfo.height / Pushval) : Pushval);
- X break;
- X case SHOVE_LEFT:
- X xofs = 0 - (Push ? (winfo.width / Pushval) : Pushval);
- X yofs = 0;
- X break;
- X case SHOVE_RIGHT:
- X xofs = Push ? (winfo.width / Pushval) : Pushval;
- X yofs = 0;
- X break;
- X }
- X
- X /*
- X * Calculate the new window position.
- X */
- X x = winfo.x + xofs;
- X y = winfo.y + yofs;
- X
- X /*
- X * Normalize the new window coordinates so we don't
- X * lose the window off the edge of the screen.
- X */
- X if (x < (0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1)))
- X x = 0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1);
- X if (y < (0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1)))
- X y = 0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1);
- X if (x > (ScreenWidth - CURSOR_WIDTH))
- X x = ScreenWidth - CURSOR_WIDTH;
- X if (y > (ScreenHeight - CURSOR_HEIGHT))
- X y = ScreenHeight - CURSOR_HEIGHT;
- X
- X /*
- X * Move the window into place.
- X */
- X XMoveWindow(dpy, w, x, y);
- X
- X Leave(FALSE)
- X}
- END_OF_awm/Push.c
- if test 5297 -ne `wc -c <awm/Push.c`; then
- echo shar: \"awm/Push.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f awm/menu_sup.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/menu_sup.c\"
- else
- echo shar: Extracting \"awm/menu_sup.c\" \(6167 characters\)
- sed "s/^X//" >awm/menu_sup.c <<'END_OF_awm/menu_sup.c'
- X#ident "%W% %G%"
- X
- X
- X
- X#ifndef lint
- Xstatic char *rcsid_menu_sup_c = "$Header: menu_sup.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
- X#endif lint
- X
- X#include "X11/copyright.h"
- X/*
- X *
- X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
- X *
- X * Copyright 1987 by Jordan Hubbard.
- X *
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Ardent Computer
- X * Corporation or Jordan Hubbard not be used in advertising or publicity
- X * pertaining to distribution of the software without specific, written
- X * prior permission.
- X *
- X */
- X
- X#include "awm.h"
- X#include <signal.h>
- X#
- X
- X/* interface functions for RTL menus */
- X
- Xdo_nothing() /* like it says... */
- X{
- X}
- X
- XBoolean check_booleans(menu, item)
- XRTLMenu menu;
- XRTLMenuItem item;
- X{
- X Boolean *foo;
- X
- X Entry("check_booleans")
- X
- X foo = (Boolean *)RTLMenu_Data(menu, item);
- X Leave(*foo)
- X}
- X
- XBoolean toggle_booleans(menu, item)
- XRTLMenu menu;
- XRTLMenuItem item;
- X{
- X Boolean *foo;
- X
- X Entry("togglet_booleans")
- X
- X foo = (Boolean *)RTLMenu_Data(menu, item);
- X *foo = !(*foo);
- X Leave(*foo)
- X}
- X
- Xint do_shell(menu, item, window) /* Do a shell command */
- XRTLMenu menu;
- XRTLMenuItem item;
- XWindow window; /* not used */
- X{
- X char *cmd;
- X int status, pid, w;
- X register int (*istat)(), (*qstat)();
- X
- X Entry("do_shell")
- X
- X cmd = (char *)RTLMenu_Data(menu, item);
- X if ((pid = fork()) == 0) {
- X setpgrp(0, 0);
- X signal(SIGHUP, SIG_IGN);
- X signal(SIGQUIT, SIG_IGN);
- X signal(SIGINT, SIG_IGN);
- X execl("/bin/sh", "sh", "-c", cmd, 0);
- X _exit(127);
- X }
- X istat = signal(SIGINT, SIG_IGN);
- X qstat = signal(SIGQUIT, SIG_IGN);
- X while ((w = wait(&status)) != pid && w != -1);
- X if (w == -1)
- X status = -1;
- X signal(SIGINT, istat);
- X signal(SIGQUIT, qstat);
- X Leave(status)
- X}
- X
- Xint do_text(menu, item, window)
- XRTLMenu menu;
- XRTLMenuItem item;
- XWindow window;
- X{
- X char *buff;
- X
- X Entry("do_text")
- X
- X buff = (char *)RTLMenu_Data(menu, item);
- X XStoreBytes(dpy, buff, strlen(buff));
- X Leave_void
- X}
- X
- Xint do_text_nl(menu, item, window)
- XRTLMenu menu;
- XRTLMenuItem item;
- XWindow window;
- X{
- X char *buff1, *buff2;
- X
- X Entry("do_text_nl")
- X
- X buff1 = (char *)RTLMenu_Data(menu, item);
- X buff2 = (char *)malloc(strlen(buff1) + 2);
- X strcpy(buff2, buff1);
- X strcat(buff2, "\n");
- X XStoreBytes(dpy, buff2, strlen(buff2));
- X free(buff2);
- X Leave_void
- X}
- X
- Xint do_awm_func(menu, item, window)
- XRTLMenu menu;
- XRTLMenuItem item;
- XWindow window;
- X{
- X int x, y, button;
- X Boolean (*func)();
- X
- X Entry("do_awm_func")
- X
- X XSync(dpy, FALSE);
- X if (window == RootWindow(dpy, scr))
- X window = Select_Window(&x, &y, &button);
- X func = (Boolean(*)())RTLMenu_Data(menu, item);
- X Leave((*func)(window, 0, button, x, y))
- X}
- X
- Xint do_imm_func(menu, item, window)
- XRTLMenu menu;
- XRTLMenuItem item;
- XWindow window;
- X{
- X Boolean (*func)();
- X
- X Entry("do_imm_func")
- X
- X func = (Boolean(*)())RTLMenu_Data(menu, item);
- X Leave((*func)(RootWindow(dpy, scr), 0, 0, 0, 0))
- X}
- X
- XMenuInfo *FindMenu(s)
- Xregister char *s;
- X{
- X MenuLink *ml;
- X
- X Entry("FindMenu")
- X
- X for (ml = Menus; ml; ml = ml->next)
- X if (!strcmp(s, ml->menu->name))
- X Leave(ml->menu)
- X Leave((MenuInfo *) 0)
- X}
- X
- XRTLMenu create_menu(m)
- XMenuInfo *m;
- X{
- X ActionLine *ln;
- X RTLMenuItem tmp;
- X MenuInfo *side_menu;
- X
- X Entry("create_menu")
- X
- X if (!m)
- X yyerror("Internal error, create_menu passed null pointer");
- X /*
- X * Were we already created? This is possible if we were referenced
- X * by somebody created before us.
- X */
- X if (m->menu)
- X Leave(m->menu)
- X m->menu = RTLMenu_Create();
- X /* make a name (or picture) label for this menu */
- X tmp = RTLMenu_Append_Call(m->menu, m->name, m->pixmapname, do_nothing, 0);
- X RTLMenu_Label_Entry(m->menu, tmp);
- X ln = m->line;
- X if (!ln) {
- X yyerror("Internal error in create_menu.");
- X fprintf(stderr, "Menu '%s' has no line list.\n", m->name);
- X exit(1);
- X }
- X if (!ln->name && !ln->pixmapname) {
- X fprintf(stderr, "awm: Action in menu '%s' has no name or backing pixmap\n",
- X m->name);
- X yyerror(".. aborting\n");
- X exit(1);
- X }
- X while (ln) {
- X switch (ln->type) {
- X case IsVar:
- X ln->item = RTLMenu_Append_Checkback(m->menu, ln->name,
- X ln->pixmapname,
- X check_booleans,
- X toggle_booleans,
- X ln->text);
- X break;
- X
- X case IsImmFunction:
- X ln->item = RTLMenu_Append_Call(m->menu, ln->name,
- X ln->pixmapname,
- X do_imm_func, ln->func);
- X break;
- X
- X case IsUwmFunction:
- X ln->item = RTLMenu_Append_Call(m->menu, ln->name,
- X ln->pixmapname,
- X do_awm_func, ln->func);
- X break;
- X
- X case IsMenuFunction:
- X if (!(side_menu = FindMenu(ln->text))) {
- X fprintf(stderr, "Unknown menu \"%s\" referenced in ",
- X ln->text);
- X yyerror(" ..");
- X exit(1);
- X }
- X /* If we haven't created the referenced menu yet, create it now */
- X if (!side_menu->menu)
- X side_menu->menu = create_menu(side_menu);
- X ln->item = RTLMenu_Append_Submenu(m->menu, ln->name,
- X ln->pixmapname,
- X side_menu->menu);
- X break;
- X
- X case IsText:
- X ln->item = RTLMenu_Append_Call(m->menu, ln->name,
- X ln->pixmapname,
- X do_text, ln->text);
- X break;
- X
- X case IsTextNL:
- X ln->item = RTLMenu_Append_Call(m->menu, ln->name,
- X ln->pixmapname,
- X do_text_nl, ln->text);
- X break;
- X
- X case IsShellCommand:
- X ln->item = RTLMenu_Append_Call(m->menu, ln->name,
- X ln->pixmapname,
- X do_shell, ln->text);
- X break;
- X
- X default:
- X fprintf(stderr, "create_menu, Unknown menu entry type %d\n",
- X ln->type);
- X break;
- X }
- X free(ln);
- X ln = ln->next;
- X }
- X Leave(m->menu)
- X}
- END_OF_awm/menu_sup.c
- if test 6167 -ne `wc -c <awm/menu_sup.c`; then
- echo shar: \"awm/menu_sup.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f awm/menus/menu.def.h -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/menus/menu.def.h\"
- else
- echo shar: Extracting \"awm/menus/menu.def.h\" \(6670 characters\)
- sed "s/^X//" >awm/menus/menu.def.h <<'END_OF_awm/menus/menu.def.h'
- X#ident "%W% %G%"
- X
- X/*
- X#ifndef lint
- Xstatic char sccs_id[] = "@(#)menu.define.h 2.1 12/16/87 Siemens Corporate Research and Support, Inc.";
- X#endif
- X*/
- X
- X
- X/*
- X RTL Menu Package Version 1.0
- X by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
- X
- X menu.h: macros for menu package
- X
- X#include "X11/copyright.h"
- X/*
- X *
- X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
- X *
- X * Copyright 1987 by Jordan Hubbard.
- X *
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Ardent Computer
- X * Corporation or Jordan Hubbard not be used in advertising or publicity
- X * pertaining to distribution of the software without specific, written
- X * prior permission.
- X *
- X */
- X
- X/*
- X
- XCopyright 1987 by
- X Siemens Corporate Research and Support, Inc., Princeton, New Jersey
- X
- XPermission to use, copy, modify, and distribute this software
- Xand its documentation for any purpose and without fee is
- Xhereby granted, provided that the above copyright notice
- Xappear in all copies and that both that copyright notice and
- Xthis permission notice appear in supporting documentation, and
- Xthat the name of Siemens not be used in advertising or
- Xpublicity pertaining to distribution of the software without
- Xspecific, written prior permission. Siemens makes no
- Xrepresentations about the suitability of this software for any
- Xpurpose. It is provided "as is" without express or implied
- Xwarranty.
- X
- X*/
- X
- X#ifndef bool
- X#define bool unsigned
- X#endif
- X
- X#ifndef FALSE
- X#define FALSE 0
- X#define TRUE 1
- X#endif
- X
- X/* Menu data structure access macros */
- X
- X#define MenuWidth(menu) (menu)->menuWidth
- X#define MenuHeight(menu) (menu)->menuHeight
- X#define MenuOldWidth(menu) (menu)->menuOldWidth
- X#define MenuOldHeight(menu) (menu)->menuOldHeight
- X#define MenuItemWidth(menu) (menu)->menuItemWidth
- X#define MenuFlags(menu) (menu)->menuFlags
- X#define MenuMaxTextWidth(menu) (menu)->menuMaxTextWidth
- X#define MenuBorderWidth(menu) MBorderWidth
- X#define MenuOldBorderWidth(menu) (menu)->menuOldBorderWidth
- X#define MenuItemPad(menu) MPad
- X#define MenuDisplay(menu) (menu)->display
- X#define MenuScreen(menu) (menu)->screen
- X#define MenuWindow(menu) (menu)->menuWindow
- X#define MenuCursor(menu) (menu)->menuCursor
- X#define MenuSavedPixmap(menu) (menu)->savedPixmap
- X#define MenuSavedImage(menu) ((menu)->savedImage)
- X#define MenuSavedImageX(menu) (menu)->menuSavedImageX
- X#define MenuSavedImageY(menu) (menu)->menuSavedImageY
- X#define MenuItems(menu) (menu)->menuItems
- X#define MenuFontInfo(menu) (menu)->menuFontInfo
- X#define MenuNormalGC(menu) (menu)->normalGC
- X#define MenuInvertGC(menu) (menu)->invertGC
- X#define MenuHighlightedGC(menu) (menu)->highlightedGC
- X#define MenuGreyGC(menu) (menu)->greyGC
- X#define MenuGreyPixmap(menu) (menu)->greyPixmap
- X#define MenuCheckmarkPixmap(menu) (menu)->checkmarkPixmap
- X#define MenuArrowPixmap(menu) (menu)->arrowPixmap
- X#define MenuInitialItemText(menu) (menu)->menuInitialItemText
- X#define MenuItemHighlighted(menu) (menu)->highlightedItem
- X#define MenuNested(menu) (menu)->menuNested
- X#define MenuX(menu) (menu)->menuX
- X#define MenuY(menu) (menu)->menuY
- X#define MenuParent(menu) (menu)->parentMenu
- X#define MenuDelta(menu) MDelta
- X#define MenuOptions(menu) (menu)->menuOptions
- X#define NULLMENU ((Menu *) NULL)
- X
- X/* Menu predicates */
- X
- X#define MenuIsNull(menu) (menu == NULLMENU)
- X#define MenuIsDisplayed(menu) (menu->menuFlags & menuMapped)
- X#define MenuHasInitialItem(menu) (menu->menuInitialItemText != (char *) NULL)
- X
- X/* Menu modifiers */
- X
- X#define SetHighlightItem(menu, item) (menu->highlightedItem = item)
- X#define ResetHighlightItem(menu) (menu->highlightedItem = NULLITEM)
- X#define SetMenuEventHandler(menu,f) menu->menuEventHandler = f
- X#define SetMenuFlag(menu, flag) MenuFlags(menu) |= flag
- X#define ResetMenuFlag(menu,flag) MenuFlags(menu) &= ~flag
- X#define TestMenuFlag(menu,flag) (MenuFlags(menu) & flag)
- X#define TestOptionFlag(menu,option) (MenuOptions(menu) & option)
- X
- X/* Item data structure access macros */
- X
- X#define ItemFlags(item) (item)->itemFlags
- X#define ItemText(item) (item)->itemText
- X#define ItemTextLength(item) (item)->itemTextLength
- X#define ItemTextWidth(item) (item)->itemTextWidth
- X#define ItemNext(item) (item)->nextItem
- X#define ItemSubmenu(item) (item)->itemSubmenu
- X#define ItemTag(item) (item)->itemTag
- X#define ItemGenerator(item) (item)->generator
- X#define ItemGeneratorParamPointer(item) (item)->genParamPointer
- X#define ItemCheckproc(item) (item)->checkproc
- X#define ItemCallback(item) (item)->itemCallback
- X#define ItemData(item) (item)->itemData
- X#define ItemWindow(item) (item)->itemWindow
- X#define ItemMenu(item) (item)->itemMenu
- X#define NULLITEM ((MenuItem *) NULL)
- X#define ItemGetArrowPosition(item) (item->itemMenu->menuWidth - arrow_width)
- X
- X/* Item predicates */
- X#define ItemIsNull(item) (item == NULLITEM)
- X#define ItemIsInitialItem(menu, item) \
- X (MenuInitialItemText(menu) && \
- X (strcmp(MenuInitialItemText(menu), ItemText(item)) == 0))
- X#define ItemIsLeaf(item) ((item->itemSubmenu == (Menu *) 0) ? TRUE : FALSE)
- X#define ItemIsDisabled(item) (ItemFlags(item) & itemDisabled)
- X#define ItemIsDeaf(item) (ItemFlags(item) & itemDeaf)
- X
- X/* Item modifiers */
- X
- X#define CheckItem(menu,item) SetItemCheck(menu,item,1)
- X#define DisableItem(menu,item) SetItemDisable(menu,item,1)
- X#define EnableItem(menu,item) SetItemDisable(menu,item,0)
- X#define UncheckItem(menu,item) SetItemCheck(menu,item,0)
- X#define SetItemFlag(item, flag) ItemFlags(item) |= flag
- X#define ResetItemFlag(item,flag) ItemFlags(item) &= ~flag
- X#define TestItemFlag(item,flag) (ItemFlags(item) & flag)
- X#define MoveItemFlag(item,flag1,flag2) \
- X if (TestItemFlag(item,flag1))\
- X SetItemFlag(item,flag2);\
- X else\
- X ResetItemFlag(item,flag2);\
- X ResetItemFlag(item,flag1);
- X
- X/* Masks */
- X
- X#define MenuEventMask (LeaveWindowMask | EnterWindowMask | ButtonReleaseMask)
- X#define NormalItemEventMask MenuEventMask
- X#define SubmenuItemEventMask (MenuEventMask | PointerMotionMask)
- X#define MenuIgnoreMask (unsigned long) 0
- X
- X/* Magic numbers */
- X
- X#define checkMarkWidth 9
- X#define checkMarkHeight 8
- X#define defaultCursorWidth 16
- X#define defaultCursorHeight 16
- X#define defaultCursorX 1
- X#define defaultCursorY 1
- X#define lineSeparatorHeight 9
- X
- X/* external declarations */
- X
- Xextern Menu *NewMenu();
- Xextern MenuItem *TrackMenu ();
- Xextern MenuItem *MenuItemByName (), *Display_Menu();
- Xextern void InitMenu ();
- Xextern void DisposeMenu ();
- Xextern void Draw_Menu();
- END_OF_awm/menus/menu.def.h
- if test 6670 -ne `wc -c <awm/menus/menu.def.h`; then
- echo shar: \"awm/menus/menu.def.h\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f awm/menus/menu.h -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"awm/menus/menu.h\"
- else
- echo shar: Extracting \"awm/menus/menu.h\" \(6217 characters\)
- sed "s/^X//" >awm/menus/menu.h <<'END_OF_awm/menus/menu.h'
- X#ident "%W% %G%"
- X
- X/*
- X#ifndef lint
- Xstatic char sccs_id[] = "@(#)menu.h 2.1 12/16/87 Siemens Corporate Research and Support, Inc.";
- X#endif
- X*/
- X
- X
- X/*
- X RTL Menu Package Version 1.0
- X by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
- X
- X menu.h: menus header file
- X based on: menu.h X10/6.6 11/3/86
- X*/
- X
- X#include "X11/copyright.h"
- X/*
- X *
- X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
- X *
- X * Copyright 1987 by Jordan Hubbard.
- X *
- X *
- X * All Rights Reserved
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Ardent Computer
- X * Corporation or Jordan Hubbard not be used in advertising or publicity
- X * pertaining to distribution of the software without specific, written
- X * prior permission.
- X *
- X */
- X
- X/*
- X
- XCopyright 1985, 1986, 1987 by the Massachusetts Institute of Technology
- X
- XPermission to use, copy, modify, and distribute this
- Xsoftware and its documentation for any purpose and without
- Xfee is hereby granted, provided that the above copyright
- Xnotice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting
- Xdocumentation, and that the name of M.I.T. not be used in
- Xadvertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- XM.I.T. makes no representations about the suitability of
- Xthis software for any purpose. It is provided "as is"
- Xwithout express or implied warranty.
- X
- X*/
- X
- X/*
- X
- XCopyright 1987 by
- X Siemens Corporate Research and Support, Inc., Princeton, New Jersey
- X
- XPermission to use, copy, modify, and distribute this
- Xsoftware and its documentation for any purpose and without
- Xfee is hereby granted, provided that the above copyright
- Xnotice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting
- Xdocumentation, and that the name of Siemens not be used in
- Xadvertising or publicity pertaining to distribution of the
- Xsoftware without specific, written prior permission.
- XSiemens makes no representations about the suitability of
- Xthis software for any purpose. It is provided "as is"
- Xwithout express or implied warranty.
- X
- X*/
- X
- X/*
- X * Menu items are constructed as follows, starting from the left side:
- X *
- X * menuItemPad
- X * space for check mark
- X * menuItemPad
- X * text + padding
- X * menuItemPad
- X *
- X * The padding for the text is that amount that this text is narrower than the
- X * widest text.
- X */
- Xextern void Retch();
- X
- X#ifndef STD_DEFS
- X#include "std_defs.h"
- X#endif
- X
- X#ifndef OPTION_FLAGS
- X#include "rtlmnu.opt.h"
- X#endif
- X
- Xtypedef void (*Callback) ();
- Xtypedef struct _menuItem MenuItem;
- Xtypedef struct _menu Menu;
- X
- X/*
- X * Special note for those familiar with the original RTL menus:
- X * Where we used to keep height and width information for items
- X * in the _menu structure, we now just keep width. Each item
- X * can be of a different height, but is still constrained
- X * to a fixed width (which is the width of the widest item in the
- X * menu). We could allow variable widths, but the menu would look
- X * like hell. We also allow arbitrary pixmap backgrounds for each
- X * item now.
- X */
- Xstruct _menuItem {
- X int itemFlags; /* flags of item */
- X
- X#define itemDisabled 0x0001 /* item is disabled */
- X#define itemChecked 0x0002 /* item has check mark */
- X#define itemDeaf 0x0004 /* item is a label */
- X#define itemChanged 0x0010 /* item desires change */
- X Pixmap itemBackground; /* either zero or a pixmap */
- X char *itemText; /* text of item (if no pixmap) */
- X unsigned int itemTextWidth; /* width of text (or pixmap) */
- X unsigned int itemTextLength; /* length of text */
- X unsigned int itemHeight; /* height of this item */
- X struct _menuItem *nextItem; /* next item in chain */
- X struct _menu *itemSubmenu; /* For pull-right menus */
- X Callback generator; /* Change string and data */
- X caddr_t genParamPointer; /* Address for generated parameter */
- X bool (*checkproc) (); /* Checkmark callback generator */
- X Callback itemCallback; /* user callback for item */
- X pointer itemData; /* user data associated with menu */
- X Window itemWindow; /* window of item */
- X Menu *itemMenu; /* menu this item belongs to */
- X};
- X
- Xstruct _menu {
- X unsigned int menuWidth; /* full width of menu */
- X unsigned int menuHeight; /* full height of menu */
- X unsigned int avgHeight; /* Hack.. */
- X unsigned int menuOldWidth;
- X unsigned int menuOldHeight;
- X unsigned int menuItemWidth; /* width of a menu item */
- X int menuFlags; /* flags of this menu */
- X
- X# define menuChanged 0x0001 /* menu changed, must redraw */
- X# define menuItemChanged 0x0002 /* item changed, must redraw */
- X# define menuMapped 0x0004 /* menu is now mapped */
- X
- X unsigned int menuMaxTextWidth; /* width of widest text */
- X unsigned int menuOldBorderWidth;
- X Display *display; /* display of menu */
- X int screen; /* screen on which to display menu */
- X Window menuWindow; /* window of menu */
- X Cursor menuCursor; /* cursor used in menu */
- X Pixmap savedPixmap; /* for saving image under menu */
- X MenuItem *menuItems; /* head of menu item chain */
- X XFontStruct *menuFontInfo; /* Font info */
- X XFontStruct *boldFont;
- X GC normalGC; /* Graphics contexts */
- X GC invertGC; /* Used for inverting entries */
- X GC highlightedGC; /* Highlighted text. */
- X GC boldGC; /* For labels */
- X Pixmap greyPixmap; /* Need to know what to free */
- X Pixmap checkmarkPixmap; /* Pixmap for drawing check mark. */
- X Pixmap arrowPixmap; /* Pixmap for drawing arrow. */
- X char *menuInitialItemText; /* != NULL, initial item */
- X MenuItem *highlightedItem; /* highlighted menu item */
- X int menuNested; /* depth you are nested */
- X int menuX, menuY; /* Menu position */
- X struct _menu *parentMenu; /* menu to which you are a submenu
- X * (NULL if you are the root)
- X */
- X MenuOptionsMask menuOptions; /* option values for this menu */
- X };
- END_OF_awm/menus/menu.h
- if test 6217 -ne `wc -c <awm/menus/menu.h`; then
- echo shar: \"awm/menus/menu.h\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo shar: End of archive 4 \(of 13\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 13 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
-